package com.edu.exam.entity.assessment;

import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import java.time.LocalDateTime;

/**
 * 来源模块实体类
 * 所属模块：B-05 考核计划管理模块
 * 对应数据库表：source_module
 *
 * 表示系统中各种数据来源的模块
 */
@Entity
@Table(name = "source_module")
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@EntityListeners(AuditingEntityListener.class)
public class SourceModule {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(name = "module_code", nullable = false, unique = true, length = 100)
    private String moduleCode;

    @Column(name = "module_name", nullable = false, length = 200)
    private String moduleName;

    @Column(name = "description", length = 500)
    private String description;

    @Column(name = "version", length = 50)
    private String version;

    @Column(name = "status", length = 50)
    private String status;

    @CreatedDate
    @Column(name = "created_time", nullable = false, updatable = false)
    private LocalDateTime createdTime;

    @LastModifiedDate
    @Column(name = "updated_time", nullable = false)
    private LocalDateTime updatedTime;

    @Column(name = "created_by", length = 100)
    private String createdBy;

    @Column(name = "updated_by", length = 100)
    private String updatedBy;
}
